﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Chapter9g.aspx.cs" Inherits="AJAX_learning.Chapter9.Chapter9g"
	Trace="true" %>

<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
	Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title></title>
</head>
<body>
	<form id="form1" runat="server">
	<asp:SqlDataSource ID="sourceEmployees" runat="server" ProviderName="System.Data.SqlClient"
		ConnectionString="<%$ ConnectionStrings:Northwind %>" SelectCommand="GetAllEmployees"
		SelectCommandType="StoredProcedure" InsertCommand="InsertEmployee" InsertCommandType="StoredProcedure"
		DeleteCommand="DeleteEmployee" DeleteCommandType="StoredProcedure">
		<DeleteParameters>
			<asp:Parameter Name="EmployeeID" Type="Int32" />
		</DeleteParameters>
		<InsertParameters>
			<asp:Parameter Name="EmployeeID" Direction="InputOutput" Type="Int32" />
			<asp:Parameter Name="FirstName" Type="String" />
			<asp:Parameter Name="LastName" Type="String" />
			<asp:Parameter Name="TitleOfCourtesy" Type="String" />
		</InsertParameters>
	</asp:SqlDataSource>
	<div>
		<asp:DetailsView ID="detailsInsertEmployee" runat="server" DataSourceID="sourceEmployees"
			DefaultMode="Insert" AutoGenerateInsertButton="True" AutoGenerateRows="False"
			DataKeyNames="EmployeeID">
			<Fields>
				<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False"
					ReadOnly="True" SortExpression="EmployeeID" />
				<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
				<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
				<asp:BoundField DataField="TitleOfCourtesy" HeaderText="TitleOfCourtesy" SortExpression="TitleOfCourtesy" />
			</Fields>
		</asp:DetailsView>
		<asp:Label ID="lblConfirmation" runat="server" EnableViewState="false" />
		<br />
		<br />
		<asp:GridView ID="gridEmployeeList" runat="server" DataSourceID="sourceEmployees"
			AutoGenerateDeleteButton="True" AutoGenerateColumns="False" 
			DataKeyNames="EmployeeID">
			<Columns>
				<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False"
					ReadOnly="True" SortExpression="EmployeeID" />
				<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
				<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
				<asp:BoundField DataField="TitleOfCourtesy" HeaderText="TitleOfCourtesy" SortExpression="TitleOfCourtesy" />
			</Columns>
		</asp:GridView>
	</div>
	</form>
</body>
</html>
